package utils;

public class ResultObj {
    private Integer code;
    private String msg;
    private Object data;

    public ResultObj() {
    }

    public ResultObj(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResultObj(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static ResultObj error(Object data){
        return  new ResultObj(ResultCode.ERROR.getCode(), ResultCode.ERROR.getMsg(),data);
    }
    public static ResultObj error(){
        return  new ResultObj(ResultCode.ERROR.getCode(), ResultCode.ERROR.getMsg());
    }
    public static ResultObj success(Object data){
        return  new ResultObj(ResultCode.SUCCESS.getCode(),ResultCode.SUCCESS.getMsg(),data);
    }
    public static ResultObj success(){
        return  new ResultObj(ResultCode.SUCCESS.getCode(),ResultCode.SUCCESS.getMsg());
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
